﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NET.LinqToSQL.Lib
{
    public class Class2
    {
        public void tes()
        {
            OrderDataContext odc = new OrderDataContext();

            var allOrders =
                from o in odc.Orders
                join od in odc.Order_Details on o.OrderID equals od.OrderID
                join p in odc.Products on od.ProductID equals p.ProductID
                select new { o.OrderID, p.ProductID, p.ProductName, totalPrice = p.UnitPrice * od.Quantity };

            foreach (var cp in allOrders)
            {
                Console.WriteLine("Order ID : {0}, Product ID : {1}, Product Name : {2}, Total Price : {3}",
                                  cp.OrderID, cp.ProductID, cp.ProductName, cp.totalPrice);
            }
        }
    }
}
